package com.d0325;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Properties;

public class TestMessageFormat {
    public static void main(String[] args) {
        FileReader fr = null;
        try {
            fr = new FileReader((new File("src/com/d0325/message.properties")));
            Properties properties = new Properties();
            properties.load(fr);
            System.out.println(MessageFormat.format(properties.getProperty("pattern"),new Object[]{"Alice",123}));
            System.out.println(MessageFormat.format(properties.getProperty("pattern"),new Object[]{"Lily",456}));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
